<?php

class Controller_Admin_Appearance_Menu_Item_Delete extends Controller
{
	function execute($request)
	{
		$menu = $request -> getParam('menu');

		$menu = Model::factory('agilet_menu', $menu);

		$form = new Form_Admin_Menu_Item_Delete;

		if ($request -> isPost() && $form -> isValid($_POST))
		{

			$menu -> deleteElement($request -> getParam('item'));

			$menu -> save();
		}

		$request -> response = View::render(array(
			'form' => $form,
			'menu' => $menu
		), 'admin/edit');
	}

}
